
USE [master]
GO

/****** Object:  Database [CrystalReportDB]    Script Date: 05/18/2011 17:44:59 ******/
CREATE DATABASE [CrystalReportDB] ON  PRIMARY 
( NAME = N'CrystalReportDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\CrystalReportDB.mdf' , SIZE = 2304KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'CrystalReportDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\CrystalReportDB_log.LDF' , SIZE = 512KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [CrystalReportDB] SET COMPATIBILITY_LEVEL = 100
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [CrystalReportDB].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [CrystalReportDB] SET ANSI_NULL_DEFAULT OFF 
GO

ALTER DATABASE [CrystalReportDB] SET ANSI_NULLS OFF 
GO

ALTER DATABASE [CrystalReportDB] SET ANSI_PADDING OFF 
GO

ALTER DATABASE [CrystalReportDB] SET ANSI_WARNINGS OFF 
GO

ALTER DATABASE [CrystalReportDB] SET ARITHABORT OFF 
GO

ALTER DATABASE [CrystalReportDB] SET AUTO_CLOSE OFF 
GO

ALTER DATABASE [CrystalReportDB] SET AUTO_CREATE_STATISTICS ON 
GO

ALTER DATABASE [CrystalReportDB] SET AUTO_SHRINK OFF 
GO

ALTER DATABASE [CrystalReportDB] SET AUTO_UPDATE_STATISTICS ON 
GO

ALTER DATABASE [CrystalReportDB] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO

ALTER DATABASE [CrystalReportDB] SET CURSOR_DEFAULT  GLOBAL 
GO

ALTER DATABASE [CrystalReportDB] SET CONCAT_NULL_YIELDS_NULL OFF 
GO

ALTER DATABASE [CrystalReportDB] SET NUMERIC_ROUNDABORT OFF 
GO

ALTER DATABASE [CrystalReportDB] SET QUOTED_IDENTIFIER OFF 
GO

ALTER DATABASE [CrystalReportDB] SET RECURSIVE_TRIGGERS OFF 
GO

ALTER DATABASE [CrystalReportDB] SET  ENABLE_BROKER 
GO

ALTER DATABASE [CrystalReportDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO

ALTER DATABASE [CrystalReportDB] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO

ALTER DATABASE [CrystalReportDB] SET TRUSTWORTHY OFF 
GO

ALTER DATABASE [CrystalReportDB] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO

ALTER DATABASE [CrystalReportDB] SET PARAMETERIZATION SIMPLE 
GO

ALTER DATABASE [CrystalReportDB] SET READ_COMMITTED_SNAPSHOT OFF 
GO

ALTER DATABASE [CrystalReportDB] SET HONOR_BROKER_PRIORITY OFF 
GO

ALTER DATABASE [CrystalReportDB] SET  READ_WRITE 
GO

ALTER DATABASE [CrystalReportDB] SET RECOVERY SIMPLE 
GO

ALTER DATABASE [CrystalReportDB] SET  MULTI_USER 
GO

ALTER DATABASE [CrystalReportDB] SET PAGE_VERIFY CHECKSUM  
GO

ALTER DATABASE [CrystalReportDB] SET DB_CHAINING OFF 
GO

USE [CrystalReportDB]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

/****** Object:  Table [dbo].[OrderMaster]    Script Date: 05/18/2011 17:32:42 ******/
CREATE TABLE [dbo].[OrderMaster](
	[OrderMaster_ID] [int] IDENTITY(1,1) NOT NULL,
	[OrderMaster_Date] [datetime] NULL ,
	[OrderMaster_CustomerName] [varchar] (50),
	[OrderMaster_CreatedUser] [varchar] (50)
	
 CONSTRAINT [PK_OrderMaster] PRIMARY KEY CLUSTERED 
(
	[OrderMaster_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Product]    Script Date: 05/18/2011 17:32:42 ******/
CREATE TABLE [dbo].[Product](
	[Product_ID] [int] IDENTITY(1,1) NOT NULL ,
	[Product_Name] [varchar] (50) ,
	[Product_Price] [numeric](18, 0) NULL
	
 CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED 
(
	[Product_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[OrderDetails] ******/
CREATE TABLE [dbo].[OrderDetails](
	[OrderDetails_ID] [int] IDENTITY(1,1) NOT NULL ,
	[OrderDetails_MasterID] [int] NULL ,
	[OrderDetails_ProductID] [int] NULL ,
	[OrderDetails_qty] [int] NULL
	
 CONSTRAINT [PK_OrderDetails] PRIMARY KEY CLUSTERED 
(
	[OrderDetails_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[OrderDetails]  WITH CHECK ADD  CONSTRAINT [FK_OrderDetails_OrderMaster] FOREIGN KEY([OrderDetails_MasterID])
REFERENCES [dbo].[OrderMaster] ([OrderMaster_ID])
GO

ALTER TABLE [dbo].[OrderDetails] CHECK CONSTRAINT [FK_OrderDetails_OrderMaster]
GO

ALTER TABLE [dbo].[OrderDetails]  WITH CHECK ADD  CONSTRAINT [FK_OrderDetails_Product] FOREIGN KEY([OrderDetails_ProductID])
REFERENCES [dbo].[Product] ([Product_ID])
GO

ALTER TABLE [dbo].[OrderDetails] CHECK CONSTRAINT [FK_OrderDetails_Product]
GO
